package com.zhan.ielts.dao.impl.speakingmodify;


import com.zhan.frame.core.dao.impl.BaseDaoImpl;
import com.zhan.frame.core.utils.BeanUtils;
import com.zhan.ielts.dao.speakingmodify.SpeakingModifyAudioDao;
import com.zhan.ielts.domain.speakingmodify.SpeakingModifyAudio;
import com.zhan.ielts.domain.vo.speakingmodify.SpeakingModifyAudioVo;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by tlfu on 2017/1/10.
 */
@Repository
public class SpeakingModifyAudioDaoImpl extends BaseDaoImpl<SpeakingModifyAudio> implements SpeakingModifyAudioDao {
    @Override
    public List<SpeakingModifyAudioVo> selectVos(Boolean isComment, SpeakingModifyAudio audio, Pageable pageable) {
        Map map =getParams(audio,pageable);
        map.put("sorting","a.`create_time` ASC");
        map.put("isComment",String.valueOf(isComment));
        return sqlSessionTemplate.selectList(getSqlName("selectVos"),map);
    }

    @Override
    public Long selectVosCount(Boolean isComment,SpeakingModifyAudio audio) {
        Map map = BeanUtils.toMap(audio);
        map.put("isComment",String.valueOf(isComment));
        return sqlSessionTemplate.selectOne(getSqlName("selectVosCount"), map);
    }

    @Override
    public void updateCorrectStatus(Map map) {
        sqlSessionTemplate.update(getSqlName("updateCorrectStatus"), map);
    }
}
